import java.io.PrintWriter;
import java.util.HashMap;

class SimpleType extends Type {

	private String name_;
	
	public SimpleType(String string) {
		name_ = string;
	}

	@Override
	public void print(PrintWriter pw) {
		pw.println("Node name : SimpleType");
		pw.println("Type is : " + name_);
	}

	public String translate(HashMap<String, PrintWriter> pws, String strPare, SymbolTable rt,
			String parent) {
		String key = rt.getStack().get(1);
		PrintWriter pw = pws.get(key);
		
		String strReturn = null;
		if (name_.equals("Integer")) {
			pw.print(strPare + "int" + " ");
			strReturn = "int";
		} else if (name_.equals("String")) {
			pw.print(strPare + "String" + " ");
			strReturn = "String";
		} else if (name_.equals("Real")) {
			pw.print(strPare + "double" + " ");
			strReturn = "double";
		} else if (name_.equals("ArrayList")) {
			pw.print(strPare + " ArrayList" + " ");
			strReturn = "ArrayList";

		} else if (name_.equals("Void")) {
			pw.print("void");
			strReturn = "Void";
		}
		return strReturn;
	}

	@Override
	public String getName() {
		return this.name_;
	}

}
